package edu.uestc.canary.repository.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * MybatisPlus配置类
 */
@Configuration
@MapperScan("edu.uestc.canary.repository.mapper")
public class MybatisPlusConfig {
    /**
     * 装配MybatisPlus的插件
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        var interceptor = new MybatisPlusInterceptor();
        //mybatis-plus分页插件
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
}
